/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pe.gov.mtc.dgac.licencias.bean;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author elvis
 */
@Entity
@Table(name = "SACP")
@NamedQueries({@NamedQuery(name = "SacpTO.findByCodSacp", query = "SELECT s FROM SacpTO s WHERE s.codSacp = :codSacp"), @NamedQuery(name = "SacpTO.findByNumSacp", query = "SELECT s FROM SacpTO s WHERE s.numSacp = :numSacp"), @NamedQuery(name = "SacpTO.findByAccionInmediata", query = "SELECT s FROM SacpTO s WHERE s.accionInmediata = :accionInmediata"), @NamedQuery(name = "SacpTO.findByFecAccionInmediata", query = "SELECT s FROM SacpTO s WHERE s.fecAccionInmediata = :fecAccionInmediata"), @NamedQuery(name = "SacpTO.findByCausaRaiz", query = "SELECT s FROM SacpTO s WHERE s.causaRaiz = :causaRaiz"), @NamedQuery(name = "SacpTO.findByAccionPropuesta", query = "SELECT s FROM SacpTO s WHERE s.accionPropuesta = :accionPropuesta"), @NamedQuery(name = "SacpTO.findByResponsableAccionProp", query = "SELECT s FROM SacpTO s WHERE s.responsableAccionProp = :responsableAccionProp"), @NamedQuery(name = "SacpTO.findByFecPrimerSeg", query = "SELECT s FROM SacpTO s WHERE s.fecPrimerSeg = :fecPrimerSeg"), @NamedQuery(name = "SacpTO.findByAuditorPs", query = "SELECT s FROM SacpTO s WHERE s.auditorPs = :auditorPs"), @NamedQuery(name = "SacpTO.findByFecSegundoSeg", query = "SELECT s FROM SacpTO s WHERE s.fecSegundoSeg = :fecSegundoSeg"), @NamedQuery(name = "SacpTO.findByAuditorSs", query = "SELECT s FROM SacpTO s WHERE s.auditorSs = :auditorSs"), @NamedQuery(name = "SacpTO.findByResultado", query = "SELECT s FROM SacpTO s WHERE s.resultado = :resultado"), @NamedQuery(name = "SacpTO.findByNuevoNumSacp", query = "SELECT s FROM SacpTO s WHERE s.nuevoNumSacp = :nuevoNumSacp")})
public class SacpTO implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @Id
    @GeneratedValue(generator = "SEQSACP")
    @SequenceGenerator(name="SEQSACP", sequenceName="SEQ_SACP",allocationSize=1)
    @Column(name = "COD_SACP", nullable = false)
    private Long codSacp;
    @Column(name = "NUM_SACP", nullable = false)
    private String numSacp;
    @Column(name = "ACCION_INMEDIATA")
    private String accionInmediata;
    @Column(name = "FEC_ACCION_INMEDIATA")
    @Temporal(TemporalType.DATE)
    private Date fecAccionInmediata;
    @Column(name = "CAUSA_RAIZ", nullable = false)
    private String causaRaiz;
    @Column(name = "ACCION_PROPUESTA", nullable = false)
    private String accionPropuesta;
    @Column(name = "RESPONSABLE_ACCION_PROP", nullable = false)
    private String responsableAccionProp;
    @Column(name = "FEC_PRIMER_SEG", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date fecPrimerSeg;
    @Column(name = "AUDITOR_PS", nullable = false)
    private String auditorPs;
    @Column(name = "FEC_SEGUNDO_SEG")
    @Temporal(TemporalType.DATE)
    private Date fecSegundoSeg;
    @Column(name = "AUDITOR_SS")
    private String auditorSs;
    @Column(name = "RESULTADO")
    private String resultado;
    @Column(name = "NUEVO_NUM_SACP")
    private String nuevoNumSacp;
    @JoinColumn(name = "COD_HALLAZGO", referencedColumnName = "COD_HALLAZGO")
    @ManyToOne
    private HallazgoTO codHallazgo;

    public SacpTO() {
        this.codHallazgo = new HallazgoTO();
    }

    public SacpTO(Long codSacp) {
        this.codSacp = codSacp;
        this.codHallazgo = new HallazgoTO();
    }

    public SacpTO(Long codSacp, String numSacp, String causaRaiz, String accionPropuesta, String responsableAccionProp, Date fecPrimerSeg, String auditorPs) {
        this.codSacp = codSacp;
        this.numSacp = numSacp;
        this.causaRaiz = causaRaiz;
        this.accionPropuesta = accionPropuesta;
        this.responsableAccionProp = responsableAccionProp;
        this.fecPrimerSeg = fecPrimerSeg;
        this.auditorPs = auditorPs;
        this.codHallazgo = new HallazgoTO();
    }

    public Long getCodSacp() {
        return codSacp;
    }

    public void setCodSacp(Long codSacp) {
        this.codSacp = codSacp;
    }

    public String getNumSacp() {
        return numSacp;
    }

    public void setNumSacp(String numSacp) {
        this.numSacp = numSacp;
    }

    public String getAccionInmediata() {
        return accionInmediata;
    }

    public void setAccionInmediata(String accionInmediata) {
        this.accionInmediata = accionInmediata;
    }

    public Date getFecAccionInmediata() {
        return fecAccionInmediata;
    }

    public void setFecAccionInmediata(Date fecAccionInmediata) {
        this.fecAccionInmediata = fecAccionInmediata;
    }

    public String getCausaRaiz() {
        return causaRaiz;
    }

    public void setCausaRaiz(String causaRaiz) {
        this.causaRaiz = causaRaiz;
    }

    public String getAccionPropuesta() {
        return accionPropuesta;
    }

    public void setAccionPropuesta(String accionPropuesta) {
        this.accionPropuesta = accionPropuesta;
    }

    public String getResponsableAccionProp() {
        return responsableAccionProp;
    }

    public void setResponsableAccionProp(String responsableAccionProp) {
        this.responsableAccionProp = responsableAccionProp;
    }

    public Date getFecPrimerSeg() {
        return fecPrimerSeg;
    }

    public void setFecPrimerSeg(Date fecPrimerSeg) {
        this.fecPrimerSeg = fecPrimerSeg;
    }

    public String getAuditorPs() {
        return auditorPs;
    }

    public void setAuditorPs(String auditorPs) {
        this.auditorPs = auditorPs;
    }

    public Date getFecSegundoSeg() {
        return fecSegundoSeg;
    }

    public void setFecSegundoSeg(Date fecSegundoSeg) {
        this.fecSegundoSeg = fecSegundoSeg;
    }

    public String getAuditorSs() {
        return auditorSs;
    }

    public void setAuditorSs(String auditorSs) {
        this.auditorSs = auditorSs;
    }

    public String getResultado() {
        return resultado;
    }

    public void setResultado(String resultado) {
        this.resultado = resultado;
    }

    public String getNuevoNumSacp() {
        return nuevoNumSacp;
    }

    public void setNuevoNumSacp(String nuevoNumSacp) {
        this.nuevoNumSacp = nuevoNumSacp;
    }

    public HallazgoTO getCodHallazgo() {
        return codHallazgo;
    }

    public void setCodHallazgo(HallazgoTO codHallazgo) {
        this.codHallazgo = codHallazgo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codSacp != null ? codSacp.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SacpTO)) {
            return false;
        }
        SacpTO other = (SacpTO) object;
        if ((this.codSacp == null && other.codSacp != null) || (this.codSacp != null && !this.codSacp.equals(other.codSacp))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "licencias_dto.SacpTO[codSacp=" + codSacp + "]";
    }

}
